﻿// See https://aka.ms/new-console-template for more information
// Console.WriteLine("Hello, World!");
// Console.WriteLine(Environment.CurrentManagedThreadId);
// using (HttpClient httpClient = new())
// {
//     string html = await httpClient.GetStringAsync("https://www.baidu.com");
//     Console.WriteLine(html);
// }
// Console.WriteLine(Environment.CurrentManagedThreadId);
// string content = "xxxx";

// await File.WriteAllTextAsync("a.txt", content);

// Console.WriteLine(Environment.CurrentManagedThreadId);
// string read = await File.ReadAllTextAsync("a.txt");
// Console.WriteLine(Environment.CurrentManagedThreadId);
// Console.WriteLine(read);

using Study005_Async_Task;
try
{
    string content = await HomeWork.GetWebStringAsync("https://www.baidu2.com");
    Console.WriteLine(content);
}
catch (Exception e)
{
    Console.WriteLine(e.Message);
}